//
// Decompiled with: Decompiler.NET, Version=1.3.1.18439, Culture=neutral, PublicKeyToken=null, Version: 1.3.1.18439
// Decompilation Started at: 3/15/2009 10:34:26 PM
// Copyright 2003 - 2004, Jungle Creatures, Inc., All Rights Reserved. 
// Written by Jonathan Pierce, Email: support@junglecreatures.com
//

namespace PatientManagement

{
		
		#region Namespace Import Declarations
		
			using CrystalDecisions.CrystalReports.Engine;
			using CrystalDecisions.Windows.Forms;
			using PatientManagement.Report;
			using System.ComponentModel;
			using System.Data.Common;
			using System.Data;
			using System.Data.SqlClient;
			using System.Drawing;
			using System;
			using System.Globalization;
			using System.Resources;
			using System.Windows.Forms;
			
		#endregion
		
	public class frmSickList : Form
	
	{
		
		#region Fields
			private Button btThoat;
			private Button btXem;
			private Container components;
			private string con;
			private DateTimePicker ddlNgayA;
			private DateTimePicker ddlNgayB;
			private dsOtherSource dsOtherSource1;
			public int flag;
			private Label label1;
			private Label label2;
			private Label label3;
			private Label label4;
			private RadioButton raOther;
			private RadioButton raPYT;
			private CrystalReportViewer report;
			private SqlConnection sqlConnection1;
			private SqlDataAdapter sqlDataAdapter1;
			private SqlCommand sqlInsertCommand1;
			private SqlCommand sqlSelectCommand1;
		#endregion
		
		#region Constructors
		
			public frmSickList ()
			
			{
				this.flag = 1;
				this.components = ((System.ComponentModel.Container) null);
				this.InitializeComponent ();
				this.con = Connection.ConnectionString ();
				return;
			}
			
		#endregion
		
		#region Methods
		
			private void btThoat_Click (object sender, EventArgs e)
			
			{
				base.Close ();
				return;
			}
			
			private void btXem_Click (object sender, EventArgs e)
			
			{
				string theString;
				SqlConnection theSqlConnection;
				DataSet theDataSet;
				SqlDataAdapter theSqlDataAdapter;
				int i;
				string theString2;
				SickList theSickList;
				SqlDataAdapter theSqlDataAdapter2;
				DataSet theDataSet2;
				int i2;
				string theString3;
				MedicineBesidesList theMedicineBesidesList;
				string[] theStringArray;
				string[] theStringArray2;
				theString = string.Empty;
				theSqlConnection = new SqlConnection (this.con);
				theDataSet = new DataSet ();
				this.ddlNgayA.CustomFormat = "MM/dd/yyyy";
				this.ddlNgayB.CustomFormat = "MM/dd/yyyy";
				if (! this.raPYT.Checked)
				{
					goto L_02BE;
				}
				theStringArray = new string[5];
				theStringArray[0] = "Select * from vw_MedicineReport where DateExportImport between \'";
				theStringArray[1] = this.ddlNgayA.Text;
				theStringArray[2] = " 00:00:00 AM\' and dateAdd(dd,1,\'";
				theStringArray[3] = this.ddlNgayB.Text;
				theStringArray[4] = " 00:00:00 AM\') ";
				theString = string.Concat (theStringArray);
				theSqlDataAdapter = new SqlDataAdapter (theString, theSqlConnection);
				theDataSet.Clear ();
				int i3 = theSqlDataAdapter.Fill (theDataSet, "vw_MedicineReport");
				if ((theDataSet != null) && ((theDataSet.Tables.Count != 0) && (theDataSet.Tables[0].Rows.Count != 0)))
				{
					goto L_0118;
				}
				
			L_00D4:
				
				{
				}
				this.report.Visible = false;
				this.ddlNgayA.CustomFormat = "dd/MM/yyyy";
				this.ddlNgayB.CustomFormat = "dd/MM/yyyy";
				DialogResult theDialogResult = MessageBox.Show ("Ch?a c? d? li?u ?? th?ng k?!", "Th?ng B?o", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				goto L_051F;
				
			L_0118:
				
				{
				}
				i = 0;
				goto L_0270;
				
			L_0120:
				
				{
				}
				theString2 = theDataSet.Tables["vw_MedicineReport"].Rows[i]["mimProductionPerUnit"].ToString ();
				if (theString2 != "0")
				{
					goto L_018B;
				}
				theDataSet.Tables["vw_MedicineReport"].Rows[i]["mimID"] = "vi?n";
				goto L_026A;
				
			L_018B:
				
				{
				}
				if (theString2 != "1")
				{
					goto L_01C9;
				}
				theDataSet.Tables["vw_MedicineReport"].Rows[i]["mimID"] = "?ng";
				goto L_026A;
				
			L_01C9:
				
				{
				}
				if (theString2 != "2")
				{
					goto L_0204;
				}
				theDataSet.Tables["vw_MedicineReport"].Rows[i]["mimID"] = "chai";
				goto L_026A;
				
			L_0204:
				
				{
				}
				if (theString2 != "3")
				{
					goto L_023F;
				}
				theDataSet.Tables["vw_MedicineReport"].Rows[i]["mimID"] = "g?i";
				goto L_026A;
				
			L_023F:
				
				{
				}
				theDataSet.Tables["vw_MedicineReport"].Rows[i]["mimID"] = "tu?p";
				
			L_026A:
				
				{
				}
				i++;
				
			L_0270:
				
				{
				}
				if (i < theDataSet.Tables["vw_MedicineReport"].Rows.Count)
				{
					goto L_0120;
				}
				this.report.Visible = true;
				theSickList = new SickList ();
				theSickList.SetDataSource (theDataSet);
				this.report.ReportSource = theSickList;
				goto L_04FF;
				
			L_02BE:
				
				{
				}
				theStringArray2 = new string[5];
				theStringArray2[0] = "Select * from vw_MedicineOrderSource where mexDateExport between \'";
				theStringArray2[1] = this.ddlNgayA.Text;
				theStringArray2[2] = " 00:00:00 AM\' and dateAdd(dd,1,\'";
				theStringArray2[3] = this.ddlNgayB.Text;
				theStringArray2[4] = " 00:00:00 AM\') ";
				theString = string.Concat (theStringArray2);
				theSqlDataAdapter2 = new SqlDataAdapter (theString, theSqlConnection);
				theDataSet2 = new DataSet ();
				int i4 = theSqlDataAdapter2.Fill (theDataSet2, "vw_MedicineOrderSource");
				if ((theDataSet2 != null) && ((theDataSet2.Tables.Count != 0) && (theDataSet2.Tables[0].Rows.Count != 0)))
				{
					goto L_0395;
				}
				
			L_0351:
				
				{
				}
				this.report.Visible = false;
				this.ddlNgayA.CustomFormat = "dd/MM/yyyy";
				this.ddlNgayB.CustomFormat = "dd/MM/yyyy";
				DialogResult theDialogResult2 = MessageBox.Show ("Ch?a c? b?c s? n?o ph?t thu?c ngo?i danh s?ch!", "Th?ng B?o", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				goto L_051F;
				
			L_0395:
				
				{
				}
				i2 = 0;
				goto L_04B4;
				
			L_039D:
				
				{
				}
				theString3 = theDataSet2.Tables["vw_MedicineOrderSource"].Rows[i2]["mexProductionPerUnit"].ToString ();
				if (theString3 != "0")
				{
					goto L_040A;
				}
				theDataSet2.Tables["vw_MedicineOrderSource"].Rows[i2]["mexUsagePerDay"] = "vi?n";
				goto L_04AE;
				
			L_040A:
				
				{
				}
				if (theString3 != "1")
				{
					goto L_0446;
				}
				theDataSet2.Tables["vw_MedicineOrderSource"].Rows[i2]["mexUsagePerDay"] = "?ng";
				goto L_04AE;
				
			L_0446:
				
				{
				}
				if (theString3 != "2")
				{
					goto L_0482;
				}
				theDataSet2.Tables["vw_MedicineOrderSource"].Rows[i2]["mexUsagePerDay"] = "chai";
				goto L_04AE;
				
			L_0482:
				
				{
				}
				theDataSet2.Tables["vw_MedicineOrderSource"].Rows[i2]["mexUsagePerDay"] = "g?i";
				
			L_04AE:
				
				{
				}
				i2++;
				
			L_04B4:
				
				{
				}
				if (i2 < theDataSet2.Tables["vw_MedicineOrderSource"].Rows.Count)
				{
					goto L_039D;
				}
				this.report.Visible = true;
				theMedicineBesidesList = new MedicineBesidesList ();
				theMedicineBesidesList.SetDataSource (theDataSet2);
				this.report.ReportSource = theMedicineBesidesList;
				
			L_04FF:
				
				{
				}
				this.ddlNgayA.CustomFormat = "dd/MM/yyyy";
				this.ddlNgayB.CustomFormat = "dd/MM/yyyy";
				
			L_051F:
				return;
			}
			
			protected override void Dispose (bool disposing)
			
			{
				this.flag = 0;
				if (! disposing)
				{
					goto L_001D;
				}
				if (this.components == null)
				{
					goto L_001D;
				}
				this.components.Dispose ();
				
			L_001D:
				
				{
				}
				base.Dispose (disposing);
				return;
			}
			
			private void frmSickList_Load (object sender, EventArgs e)
			
			{
				return;
			}
			
			private void InitializeComponent ()
			
			{
				ResourceManager theResourceManager;
				DataTableMapping[] theDataTableMappingArray;
				DataColumnMapping[] theDataColumnMappingArray;
				Control[] theControlArray;
				theResourceManager = new ResourceManager (typeof (frmSickList));
				this.label3 = new Label ();
				this.label2 = new Label ();
				this.ddlNgayB = new DateTimePicker ();
				this.ddlNgayA = new DateTimePicker ();
				this.label1 = new Label ();
				this.report = new CrystalReportViewer ();
				this.label4 = new Label ();
				this.raPYT = new RadioButton ();
				this.raOther = new RadioButton ();
				this.btXem = new Button ();
				this.btThoat = new Button ();
				this.sqlDataAdapter1 = new SqlDataAdapter ();
				this.sqlInsertCommand1 = new SqlCommand ();
				this.sqlConnection1 = new SqlConnection ();
				this.sqlSelectCommand1 = new SqlCommand ();
				this.dsOtherSource1 = new dsOtherSource ();
				((ISupportInitialize) this.dsOtherSource1).BeginInit ();
				base.SuspendLayout ();
				this.label3.Font = new System.Drawing.Font ("Verdana", 12F, FontStyle.Bold, GraphicsUnit.Point, ((byte) byte.MinValue));
				this.label3.ForeColor = Color.MediumBlue;
				this.label3.Location = new Point (400, 16);
				this.label3.Name = "label3";
				this.label3.Size = new System.Drawing.Size (160, 23);
				this.label3.TabIndex = 15;
				this.label3.Text = "Th?ng K? Thu?c";
				this.label2.Location = new Point (384, 77);
				this.label2.Name = "label2";
				this.label2.Size = new System.Drawing.Size (40, 16);
				this.label2.TabIndex = 14;
				this.label2.Text = "??n:";
				this.ddlNgayB.CustomFormat = "dd/MM/yyyy";
				this.ddlNgayB.Format = DateTimePickerFormat.Custom;
				this.ddlNgayB.Location = new Point (424, 73);
				this.ddlNgayB.Name = "ddlNgayB";
				this.ddlNgayB.Size = new System.Drawing.Size (104, 23);
				this.ddlNgayB.TabIndex = 12;
				this.ddlNgayA.CustomFormat = "dd/MM/yyyy";
				this.ddlNgayA.Format = DateTimePickerFormat.Custom;
				this.ddlNgayA.Location = new Point (264, 73);
				this.ddlNgayA.Name = "ddlNgayA";
				this.ddlNgayA.Size = new System.Drawing.Size (104, 23);
				this.ddlNgayA.TabIndex = 11;
				this.label1.Location = new Point (230, 77);
				this.label1.Name = "label1";
				this.label1.Size = new System.Drawing.Size (32, 18);
				this.label1.TabIndex = 13;
				this.label1.Text = "T?:";
				this.report.ActiveViewIndex = -1;
				this.report.DisplayGroupTree = false;
				this.report.Location = new Point (16, 104);
				this.report.Name = "report";
				this.report.ReportSource = null;
				this.report.Size = new System.Drawing.Size (872, 472);
				this.report.TabIndex = 46;
				this.report.Visible = false;
				this.label4.Location = new Point (287, 49);
				this.label4.Name = "label4";
				this.label4.Size = new System.Drawing.Size (120, 18);
				this.label4.TabIndex = 47;
				this.label4.Text = "Th?ng k? thu?c:";
				this.raPYT.Checked = true;
				this.raPYT.Location = new Point (416, 48);
				this.raPYT.Name = "raPYT";
				this.raPYT.Size = new System.Drawing.Size (120, 24);
				this.raPYT.TabIndex = 48;
				this.raPYT.TabStop = true;
				this.raPYT.Text = "Ph?ng Kh?m";
				this.raPYT.CheckedChanged += new EventHandler (this.raPYT_CheckedChanged);
				this.raOther.Location = new Point (543, 48);
				this.raOther.Name = "raOther";
				this.raOther.TabIndex = 49;
				this.raOther.Text = "Ngu?n kh?c";
				this.raOther.CheckedChanged += new EventHandler (this.raOther_CheckedChanged);
				this.btXem.FlatStyle = FlatStyle.Popup;
				this.btXem.Location = new Point (552, 72);
				this.btXem.Name = "btXem";
				this.btXem.Size = new System.Drawing.Size (72, 23);
				this.btXem.TabIndex = 50;
				this.btXem.Text = "Xem";
				this.btXem.Click += new EventHandler (this.btXem_Click);
				this.btThoat.FlatStyle = FlatStyle.Popup;
				this.btThoat.Location = new Point (632, 72);
				this.btThoat.Name = "btThoat";
				this.btThoat.Size = new System.Drawing.Size (72, 23);
				this.btThoat.TabIndex = 51;
				this.btThoat.Text = "Tho?t";
				this.btThoat.Click += new EventHandler (this.btThoat_Click);
				this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
				this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
				theDataColumnMappingArray = new DataColumnMapping[11];
				theDataColumnMappingArray[0] = new DataColumnMapping ("mexISN", "mexISN");
				theDataColumnMappingArray[1] = new DataColumnMapping ("mexMedicineName", "mexMedicineName");
				theDataColumnMappingArray[2] = new DataColumnMapping ("mexQuantityPerUnit", "mexQuantityPerUnit");
				theDataColumnMappingArray[3] = new DataColumnMapping ("mexDateExport", "mexDateExport");
				theDataColumnMappingArray[4] = new DataColumnMapping ("mexStatus", "mexStatus");
				theDataColumnMappingArray[5] = new DataColumnMapping ("mesISN", "mesISN");
				theDataColumnMappingArray[6] = new DataColumnMapping ("mexProductionPerUnit", "mexProductionPerUnit");
				theDataColumnMappingArray[7] = new DataColumnMapping ("mexTakePerDay", "mexTakePerDay");
				theDataColumnMappingArray[8] = new DataColumnMapping ("mexQuantityPerDay", "mexQuantityPerDay");
				theDataColumnMappingArray[9] = new DataColumnMapping ("mexUsagePerDay", "mexUsagePerDay");
				theDataColumnMappingArray[10] = new DataColumnMapping ("clrISN", "clrISN");
				theDataTableMappingArray = new DataTableMapping[1];
				theDataTableMappingArray[0] = new DataTableMapping ("Table", "vw_MedicineOrderSource", theDataColumnMappingArray);
				this.sqlDataAdapter1.TableMappings.AddRange (theDataTableMappingArray);
				this.sqlInsertCommand1.CommandText = "INSERT INTO vw_MedicineOrderSource(mexMedicineName, mexQuantityPerUnit, mexDateE"
				+ "xport, mexStatus, mesISN, mexProductionPerUnit, mexTakePerDay, mexQuantityPerDay"
				+ ", mexUsagePerDay, clrISN) VALUES (@mexMedicineName, @mexQuantityPerUnit, @mexDat"
				+ "eExport, @mexStatus, @mesISN, @mexProductionPerUnit, @mexTakePerDay, @mexQuantit"
				+ "yPerDay, @mexUsagePerDay, @clrISN); SELECT mexISN, mexMedicineName, mexQuantityP"
				+ "erUnit, mexDateExport, mexStatus, mesISN, mexProductionPerUnit, mexTakePerDay, m"
				+ "exQuantityPerDay, mexUsagePerDay, clrISN FROM vw_MedicineOrderSource";
				this.sqlInsertCommand1.Connection = this.sqlConnection1;
				SqlParameter theSqlParameter = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexMedicineName", SqlDbType.NVarChar, 100, "mexMedicineName"));
				SqlParameter theSqlParameter2 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexQuantityPerUnit", SqlDbType.Int, 4, "mexQuantityPerUnit"));
				SqlParameter theSqlParameter3 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexDateExport", SqlDbType.DateTime, 8, "mexDateExport"));
				SqlParameter theSqlParameter4 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexStatus", SqlDbType.TinyInt, 1, "mexStatus"));
				SqlParameter theSqlParameter5 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mesISN", SqlDbType.Int, 4, "mesISN"));
				SqlParameter theSqlParameter6 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexProductionPerUnit", SqlDbType.TinyInt, 1, "mexProductionPerUnit"));
				SqlParameter theSqlParameter7 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexTakePerDay", SqlDbType.Int, 4, "mexTakePerDay"));
				SqlParameter theSqlParameter8 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexQuantityPerDay", SqlDbType.Int, 4, "mexQuantityPerDay"));
				SqlParameter theSqlParameter9 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@mexUsagePerDay", SqlDbType.NVarChar, 50, "mexUsagePerDay"));
				SqlParameter theSqlParameter10 = this.sqlInsertCommand1.Parameters.Add (new SqlParameter ("@clrISN", SqlDbType.Int, 4, "clrISN"));
				this.sqlConnection1.ConnectionString = "data source=ASP3;initial catalog=ClinicalRecord;persist security info=False;user"
				+ " id=clinical;workstation id=ASP1;packet size=4096";
				this.sqlSelectCommand1.CommandText = "SELECT mexISN, mexMedicineName, mexQuantityPerUnit, mexDateExport, mexStatus, me"
				+ "sISN, mexProductionPerUnit, mexTakePerDay, mexQuantityPerDay, mexUsagePerDay, cl"
				+ "rISN FROM vw_MedicineOrderSource";
				this.sqlSelectCommand1.Connection = this.sqlConnection1;
				this.dsOtherSource1.DataSetName = "dsOtherSource";
				this.dsOtherSource1.Locale = new CultureInfo ("en-US");
				this.dsOtherSource1.Namespace = "http://www.tempuri.org/dsOtherSource.xsd";
				this.AutoScaleBaseSize = new System.Drawing.Size (7, 16);
				base.ClientSize = new System.Drawing.Size (902, 579);
				theControlArray = new Control[11];
				theControlArray[0] = ((Control) this.raOther);
				theControlArray[1] = ((Control) this.btThoat);
				theControlArray[2] = ((Control) this.btXem);
				theControlArray[3] = ((Control) this.raPYT);
				theControlArray[4] = ((Control) this.label4);
				theControlArray[5] = ((Control) this.report);
				theControlArray[6] = ((Control) this.label3);
				theControlArray[7] = ((Control) this.label2);
				theControlArray[8] = ((Control) this.ddlNgayB);
				theControlArray[9] = ((Control) this.ddlNgayA);
				theControlArray[10] = ((Control) this.label1);
				base.Controls.AddRange (theControlArray);
				this.Font = new System.Drawing.Font ("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte) byte.MinValue));
				base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
				base.Icon = ((System.Drawing.Icon) theResourceManager.GetObject ("$this.Icon"));
				base.MaximizeBox = false;
				base.MinimizeBox = false;
				base.Name = "frmSickList";
				base.StartPosition = FormStartPosition.CenterScreen;
				this.Text = "Th?ng K? Thu?c";
				base.Load += new EventHandler (this.frmSickList_Load);
				((ISupportInitialize) this.dsOtherSource1).EndInit ();
				base.ResumeLayout (false);
				return;
			}
			
			private void raOther_CheckedChanged (object sender, EventArgs e)
			
			{
				if (! this.raOther.Checked)
				{
					goto L_001B;
				}
				this.raPYT.Checked = false;
				goto L_0027;
				
			L_001B:
				
				{
				}
				this.raPYT.Checked = true;
				
			L_0027:
				return;
			}
			
			private void raPYT_CheckedChanged (object sender, EventArgs e)
			
			{
				if (! this.raPYT.Checked)
				{
					goto L_001B;
				}
				this.raOther.Checked = false;
				goto L_0027;
				
			L_001B:
				
				{
				}
				this.raOther.Checked = true;
				
			L_0027:
				return;
			}
			
		#endregion
	}
	
}

